define(["jquery","template",
	"scprit/nutrition/app/departmentScheme/departmentScheme.servers.js",
	"scprit/nutrition/template/departmentScheme/departmentScheme.tpl.js"], 
	function ($,template,$servers,tpl) {
    var ui = {};

    var drawSchemeList = function(data){
    	return template("nutrition_schemeList",data);
    }

    var drawAddSchemeForm = function(data){
    	return template("nutrition_addSchemeForm",data);
    }

    ui.schemeListInit = function (options) {
        $("#"+options.id).html(tpl.schemeListInit());
        var html = drawSchemeList($servers.handleSchemeList(options.list));
        $("#"+options.id).html(html);
    };

    ui.addSchemeForm = function (options) {
        var data = {}
        if(options.data) data = $.extend(data,options.data);
        options.dom.html(tpl.addSchemeForm());
        var html = drawAddSchemeForm(data);
        options.dom.html(html);
    };

    return ui;
});